<template>
  <div class="home_bargain">
    <!-- 全民砍价标题栏 -->
    <div class="bargain_header">
      <p>全民砍价</p>
      <img src="../../assets/箭头右.png" alt />
    </div>
    <!-- 全民砍价数据列表 -->
    <div class="bargain_list_container">
      <div class="bargain_list_item_wrapper">
        <div class="bargain_list_item" 
        v-for="(item,index) in bargainItems" :key="index"
        v-show="item.categoryId === 15119">
          <img :src="item.pic" alt />
          <div class="bargain_item_message">
            <div class="bargain_item_title" v-html="item.name"></div>
            <div class="bargain_item_characteristic">{{item.characteristic}}</div>
            <div class="item_message">
              <div class="item_box_x">
                <p class="item_red">￥{{item.minPrice}}</p>
                <p class="item_block">低价</p>
              </div>
              <div class="item_box_x">
                <p>{{item.originalPrice}}</p>
                <p>原价</p>
              </div>
              <div class="item_box_x">
                <p>{{item.stores}}</p>
                <p>限量</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  computed: {
    bargainItems() {
      // var allList = this.$store.state.bargainModules.bargain
      // var showList = []
      // if(allList.length>3){
      //     showList = allList.splice(-3)
      //  }
      // return showList
      return this.$store.state.bargainModules.bargain

    }
  },
  mounted(){
    this.$store.dispatch("bargainList");
  }
};
</script>

<style scoped>
.home_bargain {
  width: 100%;
}
.bargain_header {
  width: 100%;
  height: 1rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.bargain_header p {
  font-size: 0.3rem;
}
.bargain_header img {
  width: 0.25rem;
  margin-left: 0.06rem;
}
.bargain_list_container {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.bargain_list_item_wrapper {
  width: 94%;
}
.bargain_list_item {
  width: 100%;
  border-bottom: 0.03rem solid #f5f5f5;
  padding: 0.2rem 0rem;
  display: inline-flex;
  justify-content: flex-start;
  align-items: flex-start;
}
.bargain_list_item img {
  width: 2rem;
  height: 2rem;
}
.bargain_item_title {
  font-size: 0.3rem;
}
.bargain_item_characteristic {
  font-size: 0.23rem;
  margin-top: 0.2rem;
  color: gray;
}
.item_message {
  display: inline-flex;
  justify-content: flex-start;
  align-items: flex-end;
  margin-top: 0.4rem;
}
.item_red {
  color: red;
  font-weight: 700;
}
.item_box_x {
  margin-right: 0.7rem;
}
.bargain_item_message {
  margin-left: 0.1rem;
}
</style>